home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / I-Z / TE32K.sit / TE32K Demo Folder / TE32K Source ƒ / myabout.c < prev    next >
Text File  |  1992-08-27  |  3KB  |  144 lines

  1. #define LENGTH    20
  2.  
  3.  
  4.  
  5. DoAboutBox(doWait)
  6. int    doWait;
  7. {
  8. Rect            creditRect, lineRect;
  9. GrafPtr            oldPort;
  10. WindowPtr        creditWPtr;
  11. EventRecord        theEvent;
  12. long            iticks;
  13. char            *line1 = "TE32K Demo";
  14. char            *line2 = "Written by Roy Wood";
  15. char            *line3 = "©1992 Silicon Angst Software";
  16. char            *line4 = "122 Britannia Avenue";
  17. char            *line5 = "London, Ontario, Canada N6H 2J5";
  18. char            *line6 = "(519) 438-3177";
  19. int                length,oldLength,countDown,i;
  20. int                x[LENGTH][2],y[LENGTH][2],vx[2],vy[2];
  21. long            finalTicks;
  22.  
  23.     GetPort(&oldPort);
  24.     
  25.     SetRect(&creditRect, 75,75,425,200);
  26.     creditWPtr = NewWindow((WindowPeek) 0L, &creditRect, "\1x", FALSE, dBoxProc, (WindowPtr) -1L, FALSE, 0L);
  27.     SetPort(creditWPtr);
  28.     
  29.     CenterWindow(creditWPtr);
  30.     ShowWindow(creditWPtr);
  31.  
  32. MAIN:
  33.     
  34.     BeginUpdate(creditWPtr);
  35.     EndUpdate(creditWPtr);
  36.     
  37.     creditRect = creditWPtr->portRect;
  38.     SetRect(&lineRect, 100,10,350,25);
  39.     
  40.     BackPat(black);
  41.     EraseRect(&creditRect);
  42.     
  43.     TextMode(srcXor);
  44.     TextSize(12);
  45.     TextFont(3);
  46.     TextFace(bold);
  47.     TextBox(line1, strlen(line1), &lineRect, teJustCenter);
  48.     OffsetRect(&lineRect, 0 , 20);
  49.     
  50.     TextSize(10);
  51.     TextBox(line2, strlen(line2), &lineRect, teJustCenter);
  52.     
  53.     TextFace(0);
  54.     
  55.     OffsetRect(&lineRect, 0 , 25);
  56.     TextBox(line3, strlen(line3), &lineRect, teJustCenter);
  57.     OffsetRect(&lineRect, 0 , 15);
  58.     TextBox(line4, strlen(line4), &lineRect, teJustCenter);
  59.     OffsetRect(&lineRect, 0 , 15);
  60.     TextBox(line5, strlen(line5), &lineRect, teJustCenter);
  61.     OffsetRect(&lineRect, 0 , 15);
  62.     TextBox(line6, strlen(line6), &lineRect, teJustCenter);
  63.  
  64.     PenNormal();
  65.     PenMode(patXor);
  66.     
  67.     GetDateTime(&randSeed);
  68.     
  69.     x[0][0] = 50;
  70.     x[0][1] = 10;
  71.     y[0][0] = 45;
  72.     y[0][1] = 55;
  73.     
  74.     vx[0] = 2;
  75.     vx[1] = -4;
  76.     vy[0] = 3;
  77.     vy[1] = 1;
  78.     
  79.     countDown = 1;
  80.     length = 1;
  81.     oldLength = 0;
  82.     
  83.     creditRect = creditWPtr->portRect;
  84.     creditRect.right = 100;
  85.     
  86.     MoveTo((int) x[0][0],(int) y[0][0]);
  87.     LineTo((int) x[0][1],(int) y[0][1]);
  88.     
  89.     iticks = TickCount();
  90.     
  91.     do
  92.     {
  93.         for (i=0;i<=1;i++)
  94.         {
  95.             x[length][i] = x[oldLength][i] + vx[i];
  96.             
  97.             if (x[length][i] < creditRect.left + 5)
  98.                 vx[i] = (vx[i] > 0) ? vx[i] : -vx[i];
  99.             else if (x[length][i] > creditRect.right - 5)
  100.                 vx[i] = (vx[i] > 0) ? -vx[i] : vx[i];
  101.             
  102.             y[length][i] = y[oldLength][i] + vy[i];
  103.             
  104.             if (y[length][i] < creditRect.top + 5)
  105.                 vy[i] = (vy[i] > 0) ? vy[i] : -vy[i];
  106.             else if (y[length][i] > creditRect.bottom - 5)
  107.                 vy[i] = (vy[i] > 0) ? -vy[i] : vy[i];
  108.         }
  109.         
  110.         MoveTo((int) x[length][0],(int) y[length][0]);
  111.         LineTo((int) x[length][1],(int) y[length][1]);    
  112.         
  113.         oldLength = length;
  114.         
  115.         if (++length >= LENGTH)
  116.             length = 0;
  117.         
  118.         
  119.         if (countDown)
  120.             countDown = length;
  121.         
  122.         if (!countDown)
  123.         {
  124.             MoveTo((int) x[length][0],(int) y[length][0]);
  125.             LineTo((int) x[length][1],(int) y[length][1]);    
  126.         }
  127.         
  128.         SystemTask();
  129.         GetNextEvent(everyEvent, &theEvent);
  130.         
  131.         Delay(1L,&finalTicks);
  132.         
  133.         if (theEvent.what==updateEvt && theEvent.message==(long) creditWPtr)
  134.             goto MAIN;
  135.         
  136.     }    while ((!doWait && (theEvent.what != mouseDown))||(doWait && (TickCount() < iticks + doWait)));
  137.     
  138.     
  139.     DisposeWindow(creditWPtr);
  140.     
  141.     SetPort(oldPort);
  142. }
  143.  
  144.